package racer.client.gui;

public class Gametype {

	private int totalLaps;
	private int currentLaps;
	private double maxTime, time;
	private int maxPlayers;
	private int numPlayers=0;
	
	public Gametype(int laps, double time, int maxPlayers) {
		totalLaps = laps;
		maxTime = time;
		this.maxPlayers = maxPlayers;
		this.currentLaps = 0;
		this.time = 0;
	}
	
	public boolean isFinished() {
		return (currentLaps == totalLaps) || (time > maxTime); 
	}
	
	public boolean timeUp() {
		return time > maxTime;
	}
	public boolean lapsFinished() {
		return currentLaps == totalLaps;
	}
	
	public void addLap() {
		currentLaps++;
	}
	public void addTime(double elapsedTime) {
		time += elapsedTime;
	}
	public void addPlayer() {
		numPlayers++;
	}
	public void setTime(int time) {
		this.time = time;
	}
	
	public int getNumberOfPlayers() {
		return numPlayers;
	}
	public int getMaxPlayers() {
		return maxPlayers;
	}
	
}
